package org.dromara.system.domain.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.dromara.common.core.utils.StringUtils;

/**
 * 路由显示信息
 *
 * @author ruoyi
 */

@Data
public class MetaVo {


    /**
     * 设置该路由的图标，对应路径src/assets/icons/svg
     */
    @JsonProperty("icon")
    private String icon;

    /**
     * 设置为true，则不会被 <keep-alive>缓存
     */
    @JsonProperty("isKeepAlive")
    private boolean isKeepAlive;
    @JsonProperty("isAffix")
    private boolean isAffix;
    @JsonProperty("isFull")
    private boolean isFull;

    /**
     * 内链地址（http(s)://开头）
     */
    @JsonProperty("isLink")
    private String isLink;


    public MetaVo(String icon, boolean isKeepAlive, boolean isAffix, boolean isFull, String link) {
        this.icon = icon;
        this.isKeepAlive = isKeepAlive;
        this.isAffix = isAffix;
        this.isFull = isFull;
        this.isLink = StringUtils.substring(link, 0, 4).equalsIgnoreCase("http") ? link : "";
    }

}
